<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<link rel="stylesheet" type="text/css" href="../../../css/style.css"
		media="screen" />
	<meta http-equiv="refresh"
		content="#{session.maxInactiveInterval};url=general-game.xhtml?faces-redirect=true" />
</h:head>
<h:body style="margin:0px;">

	<div class="space"></div>
	<ui:include src="../../common/menu.xhtml" />
	<h:form id="form">
		<p:growl id="messages" showDetail="true" autoUpdate="true" />
		<h:panelGroup>
			<h:panelGrid columns="1" styleClass="title-filter">
				<h:outputText value="GIOCHI RAGGRUPPATI INSPIRED #{infoPageBean.page_info}"
					style="font-style: bold;font-weight: bold;" id="title" />
			</h:panelGrid>
			<div class="report-filter">
			<h:panelGrid columns="11" id="report">
				<h:outputText value="da" styleClass="white"/>
				<p:calendar id="dateStart" effect="slideDown" size="12"
					navigator="true" lang="it" value="#{reportBean.dataS}"
					pattern="dd/MM/yyyy" mindate="01/09/2010"
					maxdate="#{reportBean.oggi}">
					<p:ajax event="dateSelect" listener="#{reportBean.changeDataS}"
						update="buttonFilterData" />
					<f:convertDateTime pattern="dd/MM/yyyy" />
				</p:calendar>
				<h:outputText value="a" styleClass="white"/>
				<p:calendar id="dateEnd" effect="slideDown" size="12"
					navigator="true" lang="it" value="#{reportBean.dataE}"
					pattern="dd/MM/yyyy" mindate="01/09/2010"
					maxdate="#{reportBean.oggi}">
					<p:ajax event="dateSelect" listener="#{reportBean.changeDataE}"
						update="buttonFilterData" />
					<f:convertDateTime pattern="dd/MM/yyyy" />
				</p:calendar>
				<p:commandButton id="buttonFilterData" value="OK"
					disabled="#{reportBean.errorDate}"
					actionListener="#{reportBean.filterDataOnGroupedGameInspired}"
					onclick="dialogModal.show();" oncomplete="tab.filter();"
					update="gameGroupedReportTable,modalDialog" ajax="true" />


				<p:separator style="width:2px;height:20px" />
				<p:selectOneMenu id="filterBet" value="#{reportBean.betOpt}"
					styleClass="filter">
					<f:selectItems value="#{reportBean.contabilityOptions}"
						var="betOpt" itemValue="#{betOpt}" itemLabel="#{betOpt.label}" />
					<p:ajax event="change" listener="#{tableBeanGroupedGame.refreshTableList}"
						update="gameGroupedReportTable" oncomplete="tab.filter();" />

				</p:selectOneMenu>
#{tableBeanGroupedGame.excelExporter.setColumnCut('3')}
#{tableBeanGroupedGame.excelExporter.setNotNumericColumns('1|2|3')}
		<h:commandLink rendered="#{!reportBean.tooManyRecords}">
					<p:graphicImage value="../../../images/excel.png"
						styleClass="no-border" />
					<p:dataExporter type="xls" target="gameGroupedReportTable"
						fileName="Inpired_Grouped_Game_Export_#{reportBean.dataStoString}_#{reportBean.dataEtoString}"
						postProcessor="#{tableBeanGroupedGame.excelExporter.postProcessXLS}" />
				</h:commandLink>
				<h:commandLink rendered="#{!reportBean.tooManyRecords}">
					<p:graphicImage value="../../../images/csv.png"
						styleClass="no-border" />
					<p:dataExporter type="csv" target="gameGroupedReportTable"
						fileName="Inpired_Grouped_Game_Export_#{reportBean.dataStoString}_#{reportBean.dataEtoString}"  />
				</h:commandLink>
				<p:graphicImage value="../../../images/noexcel.png"
					styleClass="no-border" rendered="#{reportBean.tooManyRecords}" />
				<p:graphicImage value="../../../images/nocsv.png"
					styleClass="no-border" rendered="#{reportBean.tooManyRecords}" />



			</h:panelGrid>
			</div>


			<p:dialog id="modalDialog" visible="false" widgetVar="dialogModal"
				modal="true" closable="false" draggable="false" resizable="false">
				<p:ajaxStatus onstart="dialogModal.show()"
					oncomplete="dialogModal.hide()" />
				<p:graphicImage value="../../../images/loading.gif" />
			</p:dialog>

			<p:remoteCommand name="updateFooter" update=":form:gameGroupedReportTable:footer"
				oncomplete="dialogModal.hide()" />
			<div class="report-table-div">
				<p:dataTable var="meterfactGame" value="#{tableBeanGroupedGame.tableList}"
					rowKey="#{meterfactGame.tempodim.simpleTempodimToString()}-#{meterfactGame.sistemagiocodim.vlt.AAMS_VLT_ID}-#{meterfactGame.sistemagiocodim.game.AAMS_GAME_ID}"
					paginator="true" rows="13" selection="#{tableBeanGroupedGame.selectedObj}"
					filteredValue="#{tableBeanGroupedGame.filteredTableList}" widgetVar="tab"
					selectionMode="single" id="gameGroupedReportTable" additionalScrollHeight="300" paginator="true" rows="100" paginatorPosition="top" resizableColumns="true">


					<p:ajax event="rowSelect" update=":form:display"
						oncomplete="gameDialog.show()" />

					<p:ajax event="filter" listener="#{tableBeanGroupedGame.handleFilter}" oncomplete="updateFooter();" />

					<p:column sortBy="#{meterfactGame.sistemagiocodim.game.ts}" id="data_in">
						<f:facet name="header">
							<h:outputText value="DATA CREAZIONE" />
						</f:facet>
						<h:outputText value="#{meterfactGame.sistemagiocodim.game.ts}">
							<f:convertDateTime timeZone="CET" locale="#{languageBean.locale}"
								pattern="#{languageBean.datePatternSelected}" />
						</h:outputText>
					</p:column>

							
					<p:column
						sortBy="#{meterfactGame.sistemagiocodim.game.AAMS_GAME_ID}"
						filterBy="#{meterfactGame.sistemagiocodim.game.AAMS_GAME_ID}"
						filterMatchMode="contains" id="aams_game_code">
						<f:facet name="header">
							<h:outputText value="GAME CODE" />
						</f:facet>
						<h:outputText
							value="#{meterfactGame.sistemagiocodim.game.AAMS_GAME_ID}"></h:outputText>
					</p:column>

					<p:column id="gs_game_code_img" style="width:70px;" exportable="false">
						<f:facet name="header">
							<h:outputText value="GAME" />
						</f:facet>
						<p:graphicImage
							value="../../../images/giochi/#{meterfactGame.sistemagiocodim.game.AAMS_GAME_ID}.jpg"
							style="display: block;margin-left: auto;margin-right: auto;height:21px;" />
					</p:column>

					<p:column sortBy="#{meterfactGame.bet}" id="bet" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="BET" styleClass="head" />
						</f:facet>
						<h:outputText value="#{meterfactGame.bet}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>

					<p:column sortBy="#{meterfactGame.win}" id="win" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="WIN" styleClass="head" />
						</f:facet>
						<h:outputText value="#{meterfactGame.win}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>

					<p:column sortBy="#{meterfactGame.gamesPlayed}" id="gamesPlayed"
						styleClass="cella">
						<f:facet name="header">
							<h:outputText value="GAMES PLAYED" styleClass="head" />
						</f:facet>
						<h:outputText value="#{meterfactGame.gamesPlayed}" />
					</p:column>

					<p:column sortBy="#{meterfactGame.jackpotWins}" id="jackpotWins"
						styleClass="cella">
						<f:facet name="header">
							<h:outputText value="JACKPOT WINS" styleClass="head" />
						</f:facet>
						<h:outputText value="#{meterfactGame.jackpotWins}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>

					<p:column sortBy="#{meterfactGame.jackpotContribution}"
						id="jackpotContribution" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="JACKPOT CONTRIBUTION" styleClass="head" />
						</f:facet>
						<h:outputText value="#{meterfactGame.jackpotContribution}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>

					<p:column id="tab_preu" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="PREU" />
						</f:facet>
						<h:outputText value="#{meterfactGame.preu}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_aams" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="AAMS" />
						</f:facet>
						<h:outputText value="#{meterfactGame.aams}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_netwin" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="NET WIN" />
						</f:facet>
						<h:outputText value="#{meterfactGame.netWin}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_housewin" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="HOUSE WIN" />
						</f:facet>
						<h:outputText value="#{meterfactGame.houseWin}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_supplier_profit" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="Supplier Profit" />
						</f:facet>
						<h:outputText value="#{meterfactGame.supplierProfit}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_operator_profit" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="Operator Profit" />
						</f:facet>
						<h:outputText value="#{meterfactGame.supplierProfit}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<p:column id="tab_bplus_netprofit" styleClass="cella">
						<f:facet name="header">
							<h:outputText value="Bplus NetProfit" />
						</f:facet>
						<h:outputText value="#{meterfactGame.supplierProfit}">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>
					</p:column>
					<f:facet name="footer">
						<div class="footer-table">
							<p:panel id="footer" styleClass="footer">
							<h:outputText value="TOTALI: dal  " style="color:#1484E6;" />
							<h:outputText value="#{reportBean.dataS}" style="color:white;">
								<f:convertDateTime locale="it_IT" pattern="dd/MM/yyyy" />
							</h:outputText>
							<h:outputText value=" al  " style="color:#1484E6;" />
							<h:outputText value="#{reportBean.dataE}" style="color:white;">
								<f:convertDateTime locale="it_IT" pattern="dd/MM/yyyy" />
							</h:outputText>


							<h:outputText value=" - BET:  " style="color:#1484E6;" />
							<h:outputText value="#{tableBeanGroupedGame.totBet}"
								style="color:white;">
								<f:convertNumber pattern="#,##0.00" />
							</h:outputText>
							<h:outputText value=" - WIN:  " style="color:#1484E6;" />
							<h:outputText value="#{tableBeanGroupedGame.totWin}"
								style="color:white;">
								<f:convertNumber pattern="#,##0.00" />
							</h:outputText>
							<h:outputText value=" - GAMES PLAYED:  " style="color:#1484E6;" />
							<h:outputText value="#{tableBeanGroupedGame.totGamesPlayed}"
								style="color:white;">
								<f:convertNumber pattern="#,##0.00" />
							</h:outputText>
							</p:panel>
						</div>
					</f:facet>

				</p:dataTable>
			</div>
			<p:dialog header="Dati Contabili" widgetVar="gameDialog"
				resizable="false" width="300" showEffect="explode"
				hideEffect="explode">
				<center>
					<h:panelGrid id="display" columns="2" cellpadding="4">

						<f:facet name="header">
							<p:graphicImage
								value="../../../images/giochi/#{tableBeanGroupedGame.selectedObj.sistemagiocodim.game.AAMS_GAME_ID}.jpg" />
						</f:facet>

						<h:outputText value="Preu:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.preu}" id="preu"
							styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="Aams:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.aams}" id="aams"
							styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="Net Win:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.netWin}"
							id="netWin" styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="House Win:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.houseWin}"
							id="houseWin" styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="Supplier Profit:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.supplierProfit}"
							id="supplierProfit" styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="Operators Profit:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.operatorsProfit}"
							id="operatorsProfit" styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

						<h:outputText value="Bplus NetProfit:" />
						<h:outputText value="#{tableBeanGroupedGame.selectedObj.bplusNetProfit}"
							id="bplusNetProfit" styleClass="cella">
							<f:convertNumber pattern="#,##0.00" />
						</h:outputText>

					</h:panelGrid>
				</center>
			</p:dialog>



		</h:panelGroup>
	</h:form>
</h:body>
</html>
